﻿<UserControl x:Class="SD.Shapes.Samples.Xaml.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:sd="http://schemas.silverdiagram.net/sd/2010/xaml"
    xmlns:shapesBasic="clr-namespace:SD.Shapes.Templates.Basic;assembly=SD.Shapes.Templates.Basic"
    mc:Ignorable="d"
    d:DesignHeight="600" d:DesignWidth="800">

    <Grid Background="White">
        <ScrollViewer VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Visible" Background="#EEE">
            <Grid Width="700" Height="500" Background="White" Margin="20">
                <sd:GridRenderer Margin="10" />

                <sd:Diagram Background="Transparent" IsEnabled="False">
                    <shapesBasic:Rectangle Background="LightBlue" x:Name="Rect" Position="300,30" Width="100" Height="70" />
                    <shapesBasic:Ellipse Background="LightGreen" x:Name="Ellipse2" Width="80" Height="80" Position="440,150" />
                    <shapesBasic:Ellipse Background="LightGreen" x:Name="Ellipse1" Width="80" Height="80" Position="180,150" />
                    <shapesBasic:Star Background="Gold" x:Name="Star" Width="100" Height="100" Position="300,300" />

                    <sd:Connection SinkDecorator="Arrow" Thickness="2">
                        <sd:Connection.PathCalculator>
                            <sd:OrthogonalPathCalculator />
                        </sd:Connection.PathCalculator>
                        <sd:Connection.Source>
                            <sd:ConnectionPoint ConnectedNode="{Binding ElementName=Rect}" ConnectorIndex="0" />
                        </sd:Connection.Source>
                        <sd:Connection.Sink>
                            <sd:ConnectionPoint ConnectedNode="{Binding ElementName=Ellipse1}" ConnectorIndex="2" />
                        </sd:Connection.Sink>
                    </sd:Connection>

                    <sd:Connection SinkDecorator="Arrow" Thickness="2">
                        <sd:Connection.PathCalculator>
                            <sd:OrthogonalPathCalculator />
                        </sd:Connection.PathCalculator>
                        <sd:Connection.Source>
                            <sd:ConnectionPoint ConnectedNode="{Binding ElementName=Rect}" ConnectorIndex="1" />
                        </sd:Connection.Source>
                        <sd:Connection.Sink>
                            <sd:ConnectionPoint ConnectedNode="{Binding ElementName=Ellipse2}" ConnectorIndex="2" />
                        </sd:Connection.Sink>
                    </sd:Connection>

                    <sd:Connection SinkDecorator="Arrow" Thickness="2">
                        <sd:Connection.PathCalculator>
                            <sd:OrthogonalPathCalculator />
                        </sd:Connection.PathCalculator>
                        <sd:Connection.Source>
                            <sd:ConnectionPoint ConnectedNode="{Binding ElementName=Ellipse2}" ConnectorIndex="3" />
                        </sd:Connection.Source>
                        <sd:Connection.Sink>
                            <sd:ConnectionPoint ConnectedNode="{Binding ElementName=Star}" ConnectorIndex="0" />
                        </sd:Connection.Sink>
                    </sd:Connection>

                    <sd:Connection SinkDecorator="Arrow" Thickness="2">
                        <sd:Connection.PathCalculator>
                            <sd:OrthogonalPathCalculator />
                        </sd:Connection.PathCalculator>
                        <sd:Connection.Source>
                            <sd:ConnectionPoint ConnectedNode="{Binding ElementName=Ellipse1}" ConnectorIndex="3" />
                        </sd:Connection.Source>
                        <sd:Connection.Sink>
                            <sd:ConnectionPoint ConnectedNode="{Binding ElementName=Star}" ConnectorIndex="0" />
                        </sd:Connection.Sink>
                    </sd:Connection>
                </sd:Diagram>
            </Grid>
        </ScrollViewer>
    </Grid>
</UserControl>
